package com.itheima.网络编程.tcp编程.tcp编程.tcp线程池案例四;

import java.io.*;
import java.net.Socket;

public class 客户端 {
    public static void main(String[] args) {
        try {
            Socket sk = new Socket("127.0.0.1", 10000);
            BufferedReader br = new BufferedReader(new FileReader("day16 网络编程\\subways.txt"));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(sk.getOutputStream()));
            String str;
            while ((str = br.readLine()) != null) {
                bw.write(str);
                bw.newLine();
                bw.flush();
            }
            sk.shutdownOutput();
            System.out.println("==============================");
            BufferedReader brc = new BufferedReader(new InputStreamReader(sk.getInputStream()));
            String s;
            while ((s = brc.readLine()) != null) {
                System.out.println(s);
            }
            brc.close();
            bw.close();
            br.close();
            sk.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
